package com.dc.chat.app.service.mp;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dc.chat.entity.dao.Admin;
import org.springframework.stereotype.Service;

@Service
public class AdminService extends ServiceImpl<AdminService.AdminMapper,Admin> {
    public Admin selectByUsernameAndPassword(String username, String password) {
        LambdaQueryWrapper<Admin> wr = Wrappers.lambdaQuery(new Admin());
        wr.eq(Admin::getUsername,username);
        wr.eq(Admin::getPassword,password);
        wr.last(" limit 1");
        return baseMapper.selectOne(wr);
    }

    public interface AdminMapper extends BaseMapper<Admin>{

    }
}
